Skip Headers

Oracle® OLAP DML Reference 10g Release 2 (10.2) Part Number B14346-01 |
Home | Book List | Contents | Index | Master Index | Feedback

Previous | Next
| View PDF

# TRIGGER function

The TRIGGER function retrieves the event, subevent, or name of the object or analytic workspace that caused the execution of a trigger program (that is, a TRIGGER_DEFINE, TRIGGER_AFTER_UPDATE, or TRIGGER_BEFORE_UPDATE program, or any program identified as a trigger program using the TRIGGER command).

When the current program is a trigger program, the TRIGGER function returns the trigger information for that program. When it is not, the TRIGGER function returns trigger information for the most recently executed trigger program.

See also: "Trigger Programs".

Return Values

`TEXT`

Syntax

TRIGGER (NAME | EVENT | SUBEVENT)

Arguments

NAME

  For a program identified as a trigger program using the TRIGGER command, returns the object for which the trigger program is association. For a TRIGGER_AW, TRIGGER_DEFINE, TRIGGER_AFTER_UPDATE, or TRIGGER_BEFORE_UPDATE program, returns the name of the analytic workspace that caused the program to execute.

EVENT

  Returns the name of the event (DML statement) that triggered the execution of the program.

    AW
    MAINTAIN
    DELETE
    DEFINE
    PROPERTY
    ASSIGN
    BEFORE_UPDATE
    AFTER_UPDATE

  For more information on trigger events, see TRIGGER command and TRIGGER_DEFINE.

SUBEVENT

  When the value returned by EVENT is `MAINTAIN`, `AFTER_UPDATE` or `BEFORE_UPDATE`, returns more information on the OLAP DML statement that triggered the execution of the program. Valid subevents for `AW` are outlined in Table 24-1, "Subevents for the AW Event". Valid subevents for `MAINTAIN` are outlined in Table 24-2, "Subevents for the MAINTAIN Event". Valid subevents for `UPDATE` are outlined in Table 24-3, "Subevents for UPDATE Events".

  Table 24-1 Subevents for the AW Event

  Subevent | Description
  --- | ---
  CREATE | Returned when a AW CREATE statement triggered the execution of the program.
  ATTACH | Returned when a AW ATTACH statement triggered the execution of the program.
  DELETE | Returned when a AW DELETE statement triggered the execution of the program.
  DETACH | Returned when a AW DETACH statement triggered the execution of the program.

  Table 24-2 Subevents for the MAINTAIN Event

  Subevent | Description
  --- | ---
  ADD | Returned when a MAINTAIN ADD statement triggered the execution of the program.
  DELETE | Returned when any MAINTAIN DELETE statement except a MAINTAIN DELETE ALL statement triggered the execution of the program.
  DELETE ALL | Returned when a MAINTAIN DELETE ALL statement triggered the execution of the program.
  MERGE | Returned when a MAINTAIN MERGE statement triggered the execution of the program.
  MOVE | Returned when a MAINTAIN MOVE statement triggered the execution of the program.
  RENAME | Returned when a MAINTAIN RENAME statement triggered the execution of the program.

  Table 24-3 Subevents for UPDATE Events

  Subevent | Description
  --- | ---
  AW | Returned when an UPDATE statement triggered the execution of a TRIGGER_AFTER_UPDATE or TRIGGER_BEFORE_UPDATE program.
  MULTI | Returned when an UPDATE statement triggered the execution of a program identified as a trigger program using the TRIGGER command when an object is acquired in multiwriter mode.

Examples

For examples of using the TRIGGER function, see Example 24-12, "TRIGGER_BEFORE_UPDATE Program", Example 24-7, "A MAINTAIN Trigger Program", Example 24-11, "TRIGGER_AFTER_UPDATE Program", Example 24-13, "A TRIGGER_DEFINE Program", and Example 24-14, "Assigning an Alternative Value using an Assign Trigger".